Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to config gem 2.0.0 #19418

Merged
merged 1 commit into from
Oct 22, 2019
Merged

Conversation

jrafanie
Copy link
Member

@jrafanie jrafanie commented Oct 18, 2019

EDIT:

Added cross-repo tests against this branch:

Also, config gem at 1.6.1 was loading dry-validation which was really slow. Now
with 2.0.0, it uses dry-schema, which is slightly less slow. It seems to save
~0.3 seconds on rails boot.

Config 1.6.1:

04:49:04 ~/Code/manageiq (master) (2.6.5) + time ruby -e "require './config/environment'"
ruby -e "require './config/environment'"  6.12s user 3.84s system 88% cpu 11.227 total
04:49:17 ~/Code/manageiq (master) (2.6.5) + time ruby -e "require './config/environment'"
ruby -e "require './config/environment'"  5.81s user 3.23s system 99% cpu 9.133 total
04:49:28 ~/Code/manageiq (master) (2.6.5) + time ruby -e "require './config/environment'"
ruby -e "require './config/environment'"  5.92s user 3.32s system 98% cpu 9.338 total
04:49:38 ~/Code/manageiq (master) (2.6.5) + time ruby -e "require './config/environment'"
ruby -e "require './config/environment'"  6.09s user 3.55s system 98% cpu 9.793 total

Config 2.0.0:

04:43:03 ~/Code/manageiq (master) (2.6.5) - time ruby -e "require './config/environment'"
ruby -e "require './config/environment'"  5.90s user 3.53s system 90% cpu 10.403 total
04:43:16 ~/Code/manageiq (master) (2.6.5) + time ruby -e "require './config/environment'"
ruby -e "require './config/environment'"  5.54s user 2.99s system 99% cpu 8.610 total
04:43:25 ~/Code/manageiq (master) (2.6.5) + time ruby -e "require './config/environment'"
ruby -e "require './config/environment'"  5.64s user 3.14s system 98% cpu 8.879 total
04:43:35 ~/Code/manageiq (master) (2.6.5) + time ruby -e "require './config/environment'"
ruby -e "require './config/environment'"  5.64s user 3.12s system 99% cpu 8.841 total

* 1.7.0 introduced merge_nil_values, ironically by me, which we have to disable.
This is because we often have leaf configurations with nil values as examples,
which overwrite core values, leading to lots of problems.  For now we have to
disable this behavior.

https://github.com/railsconfig/config/pull/196/files
See also: https://github.com/ManageIQ/manageiq/pull/16982/files

* 2.0.0 changed the Config constant to be defined on Object, not Kernel, so we
need to update our configuration to reflect this same change:

https://github.com/railsconfig/config/pull/227/files

Also, config gem at 1.6.1 was loading dry-validation which was really slow.  Now
with 2.0.0, it uses dry-schema, which is slightly less slow.  It seems to save
~0.3 seconds on rails boot.

Config 1.6.1:

```
04:49:04 ~/Code/manageiq (master) (2.6.5) + time ruby -e "require './config/environment'"
ruby -e "require './config/environment'"  6.12s user 3.84s system 88% cpu 11.227 total
04:49:17 ~/Code/manageiq (master) (2.6.5) + time ruby -e "require './config/environment'"
ruby -e "require './config/environment'"  5.81s user 3.23s system 99% cpu 9.133 total
04:49:28 ~/Code/manageiq (master) (2.6.5) + time ruby -e "require './config/environment'"
ruby -e "require './config/environment'"  5.92s user 3.32s system 98% cpu 9.338 total
04:49:38 ~/Code/manageiq (master) (2.6.5) + time ruby -e "require './config/environment'"
ruby -e "require './config/environment'"  6.09s user 3.55s system 98% cpu 9.793 total
```

Config 2.0.0:

```
04:43:03 ~/Code/manageiq (master) (2.6.5) - time ruby -e "require './config/environment'"
ruby -e "require './config/environment'"  5.90s user 3.53s system 90% cpu 10.403 total
04:43:16 ~/Code/manageiq (master) (2.6.5) + time ruby -e "require './config/environment'"
ruby -e "require './config/environment'"  5.54s user 2.99s system 99% cpu 8.610 total
04:43:25 ~/Code/manageiq (master) (2.6.5) + time ruby -e "require './config/environment'"
ruby -e "require './config/environment'"  5.64s user 3.14s system 98% cpu 8.879 total
04:43:35 ~/Code/manageiq (master) (2.6.5) + time ruby -e "require './config/environment'"
ruby -e "require './config/environment'"  5.64s user 3.12s system 99% cpu 8.841 total
```
@@ -33,7 +33,7 @@ gem "bcrypt", "~> 3.1.10", :require => false
gem "bundler", ">=1.15", :require => false
gem "byebug", :require => false
gem "color", "~>1.8"
gem "config", "~>1.6.0", :require => false
gem "config", "~>2.0", :require => false
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can lock this down to ~>2.0.0 if desired. It's been pretty stable, so 🤷‍♂

@miq-bot
Copy link
Member

miq-bot commented Oct 18, 2019

Checked commit jrafanie@2711b70 with ruby 2.4.6, rubocop 0.69.0, haml-lint 0.20.0, and yamllint 1.10.0
2 files checked, 0 offenses detected
Everything looks fine. 👍

@Fryguy
Copy link
Member

Fryguy commented Oct 20, 2019

Please run other repos with this change.

@jrafanie
Copy link
Member Author

@Fryguy Fryguy merged commit ab9b93b into ManageIQ:master Oct 22, 2019
@Fryguy Fryguy added this to the Sprint 123 Ending Oct 28, 2019 milestone Oct 22, 2019
@jrafanie jrafanie deleted the update_config_gem branch October 22, 2019 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants